package org.ioc.com.springioc5.controller;

import jakarta.annotation.Resource;
import org.ioc.com.springioc5.model.UserInfo;
import org.ioc.com.springioc5.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;

@Controller
public class UserController {
    //@Autowired
    private UserService userService;
    @Qualifier("userInfo1")
    @Autowired
    private UserInfo userInfo2;
    public UserController(){

    }
    @Autowired
    public UserController(UserService userService){
        this.userService=userService;
    }
    public void say(){
        String name = userInfo2.getName();
        System.out.println(name);
        userService.say();
        System.out.println("hi,USerController");
    }
}
